<template>
	<view class="content">
		<view class="content-top">
			<text class="lg cuIcon-emojifill"></text>
			<view>您的肯定，是我们进步的最大动力~</view>
		</view>
		<view class="line-view"></view>
		<view class="score-view">
			<view class="example-title">反馈及时</view>
			<view class="example-body">
				<uni-rate @change="onChangeStar"></uni-rate>
			</view>
			<view class="example-title">处理结果</view>
			<view class="example-body">
				<uni-rate @change="onChangeTimeStar" />
			</view>
		</view>
		<view class="complain_content">
			<view class="title"> 我还想说: </view>
			<textarea class="content-text" maxlength="-1" @input="textareaInput" placeholder="请输入内容"> </textarea>
		</view>

		<view class="navigatior navigator_btn" @click="commit">提交</view>
		
	</view>
</template>

<script>
	import uniRate from '@/components/uni-rate/uni-rate.vue'
	export default {
		components: {
			uniRate
		},
		data() {
			return {
				content:'',
				'star':0,
				'timeStar':0,
				'complainId':''
			}
		},
		onLoad(option) {
			this.complainId = option.complainId;
		},
		methods: {
			onChangeStar(e) {
				this.star = e.value;
			},
			onChangeTimeStar(e) {
				this.timeStar = e.value;
			},
			textareaInput(e) {
				this.content = e.detail.value;
			},
			commit() {
				uni.showLoading({
					title: '加载中...',
					mask: false
				});
				var data = {
					"COMPLAINT_ID" : this.complainId,
					"STAR" : this.star,
					"TIMESTAR": this.timeStar,
					"RECONTENT": this.content
				}
				uni.request({
					url: this.websiteUrl + 'appim/addComplaints',
					method: 'POST',
					data: data,
					header:{
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: res => {
						uni.setStorageSync('complainscore', 'complainscore');
						uni.navigateBack();
					},
					fail: () => {},
					complete: () => {
						uni.hideLoading();
					}
				});
			}
		},
	}
</script>

<style>
	page {
		font-size: 16px;
	}
	.content {
		background-color: #FFFFFF;
	}
	.content-top {
		text-align: center;
	}
	.cuIcon-emojifill {
		font-size: 3rem;
		color: orange;
	}
	.line-view {
		height: 1px;
		background-color: #F8F8F8;
		margin: 20px 10px;
	}
	
	.example {
		padding: 0 30upx 30upx
	}
	
	.example-title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 32upx;
		color: #464e52;
		padding: 10upx 30upx 10upx 50upx;
		margin-top: 20upx;
		position: relative;
		background-color: #fdfdfd;
		/* border-bottom: 1px #f5f5f5 solid */
	}
	
	.example-title__after {
		position: relative;
		color: #031e3c
	}
	
	.example-title:after {
		content: '';
		position: absolute;
		left: 30upx;
		margin: auto;
		top: 0;
		bottom: 0;
		width: 6upx;
		height: 32upx;
		background-color: #19c99a;
	}
	
	.example .example-title {
		margin: 40upx 0
	}
	
	.example-body {
		padding: 30upx;
		background: #fff;
		padding: 0 14px;
	}
	.complain_content {
		padding: 14px;
	}
	.content-text {
		border: 1px solid #CCCCCC;
		border-radius: 4px;
		height: 100px;
		width: 100%;
		padding: 10upx;
		margin-top: 5px;
	}
	
	.navigatior {
		/* line-height: 20px; */
		margin-bottom: 20px;
		margin-top: 10px;
		
	}
	.navigator_btn {
		background-color: #19c99a;
		color: white;
		border: 1px solid #19C99A;
		border-radius: 4px;
		font-size: 14px;
		padding:5px 10px;
		width: 30%;
		margin-left: 35%;
		text-align: center;
		margin-top: 20px;
	}
</style>
